<div class="wrapper">
    <div>
        <!-- 货物类型表单 -->
        <div class="box box-top">
            <!-- /.box-header -->
            <!-- form start -->
            <form id="batteryCabinetForm" role="form" action="${base}/admin/batteryCabinet/save" method="post">
                <input type="hidden" name="id" value="${(batteryCabinet.id?c)!}">
                <div class="box-body">
                    <div class="form-group">
                        <label for="departmentId">区域管理</label>
                        <select class="form-control select2" style="width: 100%;" id="departmentId" name="departmentId">
                            <#list departments as department_>
                                <option
                                <#if batteryCabinet?? && batteryCabinet.departmentId??>
                                    <#if (department_.id)! == (batteryCabinet.departmentId)!> selected="selected"</#if>
                                </#if>
                                value="${(department_.id)!}">
                                ${(department_.name)!}
                                </option>
                            </#list>
                        </select>
                    </div>
                        <div class="form-group">
                            <label for="no">Code</label>
                            <input type="text" value="${(batteryCabinet.no)!}" class="form-control" name="no" id="no">
                        </div>
                        <div class="form-group">
                            <label for="name">Name</label>
                            <input type="text" value="${(batteryCabinet.name)!}" class="form-control" name="name" id="name">
                        </div>
                        <div class="form-group">
                            <label for="longitude">经度</label>
                            <input type="text" value="${(batteryCabinet.longitude?c)!}" class="form-control" name="longitude" id="longitude">
                        </div>
                        <div class="form-group">
                            <label for="latitude">纬度</label>
                            <input type="text" value="${(batteryCabinet.latitude?c)!}" class="form-control" name="latitude" id="latitude">
                        </div>
                        <div class="form-group">
                            <label for="address">地址</label>
                            <input type="text" value="${(batteryCabinet.address)!}" class="form-control" name="address" id="address">
                        </div>
                        <div class="form-group">
                            <label for="address">访问地址</label>
                            <input type="text" value="${(batteryCabinet.serverUrl)!}" class="form-control" name="serverUrl" id="serverUrl">
                        </div>
                        <div class="form-group">
                            <label for="memo">Note</label>
                            <input type="text" value="${(batteryCabinet.memo)!}" class="form-control" name="memo" id="memo">
                        </div>
                    <div>
                        <button type="button" onclick="$('#batteryCabinetForm').submit();" class="btn btn-primary">Save
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function() {
        $("#batteryCabinetForm").validate({
            submitHandler:function(form){
                submitBatteryCabinet();
            }
        });
    });
    function submitBatteryCabinet(){
        HF.ajaxFormSubmit('batteryCabinetForm',function(result){
            alert("Save Success");
            document.location.reload();
        },function(e){ alert("Save Failure");});
    }
</script>
